package com.accenture.fd.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.accenture.fd.dao.DtoSourceDao;
import com.accenture.fd.entity.DtoToSource;
import com.accenture.fd.service.DtoSourceService;

@Service
public class DtoSourceServiceImpl implements DtoSourceService {

	@Autowired
	private DtoSourceDao dtoSourceDao;

	@Override
	public List<DtoToSource> getDtoSource(String classId) {
		return dtoSourceDao.findById(classId);
	}

	@Override
	public void saveDesignDto(DtoToSource dtoTosrc) {
		dtoSourceDao.deleteById(dtoTosrc.getScreenId(), dtoTosrc.getClassId());
		dtoSourceDao.insert(dtoTosrc);
	}

	@Override
	public void deleteDesignDto(String screenId) {
		dtoSourceDao.deleteByScreenIdId(screenId);
	}

	@Override
	public void saveDesignDtoList(List<DtoToSource> saveList) {
		dtoSourceDao.saveAll(saveList);
	}


}
